<%@ page language="java" import="java.util.*,com.hs.auth.model.*,com.hs.core.utils.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
PageUtil pageUtil = (PageUtil)request.getAttribute("dataList");
String loginId = (String)request.getAttribute("loginId");
String userName = (String)request.getAttribute("userName");

List dataList = null;
String pageStr = "";
int perpageCount = 0;
int currentPage = 0;
if(pageUtil != null){
	   dataList = pageUtil.getPageList();
	   pageStr = pageUtil.getPageStr();
	   perpageCount = pageUtil.getNumberPerPage();
	   currentPage = pageUtil.getCurrentPage();
}

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head> 
<title></title>
<script src="<%=basePath %>app/javascripts/jquery-1.5.1.js"></script>
<script src="<%=basePath %>app/javascripts/layout.js"></script>
<script src="<%=basePath %>common/javascript/common.js"></script>
<script src='<%=basePath%>dwr/engine.js'></script>
<script src='<%=basePath%>dwr/util.js'></script> 
<script src='<%=basePath%>dwr/interface/authdwr.js'></script> 
<link rel="stylesheet" type="text/css" href="<%=basePath %>app/css/layout.css">
<style>.tac{text-align:center}</style>
<script>
function searchData(){

searchform.submit();
}

function modifyData(accid){
	
     window.parent.oper.frameElement.src = "<%=basePath%>auth/userInfo.do?uid="+accid; 
 
}
 function deleteUser(id){
 	if(confirm("确定要删除该用户帐号吗?")){
 		authdwr.deleteUser(id,callback4delete);
 	}
 }
 function callback4delete(){
    alert("成功删除帐号!");
    searchform.submit();
    window.parent.oper.frameElement.src = "<%=basePath%>auth/userInfo.do";
    //window.parent.list.frameElement.src = "<%=basePath%>auth/listUser.do"; 
    
 }
 function addUser(){
 	     window.parent.oper.frameElement.src = "<%=basePath%>auth/userInfo.do"; 
 	
 
 }
</script>
</head>
<body>
    <div class="cont">     
    <form name="searchform" action="<%=basePath %>auth/listUser.do" method="post">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="deta_list_sear">
			 <tr>
			     <td width="15%">
			       用户姓名：
			       </td>
			       <td width="20%">
			       <input name="userName" type="text" value="<%=userName==null?"":userName %>" class="sear_input"/> 
			       </td>
			       <td width="15%">
			       帐号：
			       </td>
			       <td width="20%">
			        <input name="loginId" type="text" value="<%=loginId==null?"":loginId %>" class="sear_input"/>
			        </td> 
			    <td width="15%">
			      <input onclick="searchData();" type="button" value="查询" class="butt2"/> 
 			    </td>
			    <td width="15%">
            		  <input onclick="addUser();" type="button" value="新增帐号" class="butt4"/> 
			    </td>
			</tr>
		</table>
        </form>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="list">
          <tr> 
            <th width="5%">序号</th>
            <th width="10%">用户名</th>
            <th width="10%">用户状态</th>
            <th width="15%">姓名</th>
            <th width="10%">电话</th>
            <th width="15%">邮件</th>
            <th width="20%">通信地址</th> 
            <th width="10%">修改</th> 
            <th width="10%">删除</th> 
            
          </tr>
          <%if(dataList != null && dataList.size()>0){ 
			    for(int i =0;i<dataList.size();i++){
			       HsAccount obj = (HsAccount)dataList.get(i); 
			       HsUserinfo userinfo = obj.getUserinfo();
			%>
			<tr> 
			<td align=center><%=perpageCount*(currentPage-1)+i+1 %></td>
			<td align=center><%=obj.getLoginid() %></td>
			<td align=center><font color=red><%if("0".equals(obj.getStatus()+"")){out.print("无效");}  %><%if("1".equals(obj.getStatus()+"")){out.print("锁定");}  %><%if("2".equals(obj.getStatus()+"")){out.print("有效");}  %></font></td>
			<td align=center><%=userinfo.getUsername() %></td>
			<td align=center><%=StringUtilTool.NULL2Blank(userinfo.getPhone()) %></td>
			<td><%=StringUtilTool.NULL2Blank(userinfo.getEmail()) %></td>
			<td><%=StringUtilTool.NULL2Blank(userinfo.getAddress()) %></td>
			<td align="center"><input onclick="modifyData('<%=obj.getId() %>');" type="button" value="修改"  class="but_2"/></td>
			<td align="center"><%if(!"system".equals(obj.getLoginid())){ %><input onclick="deleteUser('<%=obj.getId() %>');" type="button" value="删除" class="but_2"/><%} %> </td> 
			 
			</tr> 
			<%}}else{ %>
			<tr>
            <td colspan=9 align="center"><font color=red><strong>当前没有人员信息！</strong></font></td>
          </tr>
          <tr>
	          <td colspan=9>
	          <%=pageStr  %>
	          </td>
          </tr>
          <%} %>
          
        </table>
		
        
  </div>

</body>
</html>
